<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <meta name="renderer" content="webkit">
    <title>添加管理员</title>
    <link rel="stylesheet" href="/static/css/pintuer.css">
    <link rel="stylesheet" href="/static/css/admin.css">
    <script src="/static/js/jquery.js"></script>
    <script src="/static/js/pintuer.js"></script>


</head>
<body>
<div class="panel admin-panel">
    <div class="panel-head"><strong><span class="icon-pencil-square-o"></span>添加管理员</strong></div>
    <div class="body-content">
        <form class="form-clazz" action="">
            <div class="form-group">
                <div class="label">
                    <label>管理员用户名：</label>
                </div>
                <div class="field">
                    <input type="text" class="input" name="uname" id="uname" value="" style="width:30%"/>
                    <div class="tips"></div>
                </div>
            </div>
            <div class="form-group">
                <div class="label">
                    <label>管理员密码：</label>
                </div>
                <div class="field">
                    <input type="text" class="input" name="upwd" id="upwd" value="" style="width:30%"/>
                </div>
            </div>

            <div class="form-group">
                <div class="label">
                    <label>管理员真实姓名：</label>
                </div>
                <div class="field">
                    <input type="text" class="input" name="urealname" id="urealname" value="" style="width:30%"/>
                </div>
            </div>

            <div class="form-group">
                <div class="label">
                    <label></label>
                </div>
                <div class="field">
                    <button id="btn" class="button bg-main icon-check-square-o" type="button"> 提交</button>
                </div>
            </div>
        </form>
    </div>
</div>
</body>
<script>

    $('#btn').click(function () {
        console.log("click")
        $.ajax({
            url: "/user/save",
            data: {
                username: $("#uname").val(),
                password: $("#upwd").val(),
                realname: $("#urealname").val()
            },
            type: "POST",
            dataType: "JSON",
            success: function (res) {
                if (res.code !== 200) {
                    alert("添加失败");
                } else {
                    alert("添加成功");
                    $("#uname").val("");
                    $("#upwd").val("");
                    $("#urealname").val("");
                }
            }
        })
    });

</script>
</html>